<?php
// No direct access
defined('_JEXEC') or die;

$defaultFields = $this->tableDefaultFields;
$fields = $this->tableFields;

$fieldId = array_shift($defaultFields);

$genmFields = $this->genmFields;

$ignoreArray = array('checked_out', 'checked_out_time');
?>

<ul>
	<?php foreach ($fields as $field): ?>
	<?php $checked = (in_array($field->name, $genmFields)) ? 'checked="checked"' : null; ?>
	<li style="float: left; margin: 0; padding: 0; width: 160px;">
		<input <?php echo $checked; ?> name="jform[fields][]" type="checkbox" value="<?php echo $field->name; ?>" /> <span style="float: left; line-height: 23px;"><?php echo $field->name; ?></span>
	</li>
	<?php endforeach; ?>
	<?php 
	foreach ($defaultFields as $key => $field): 
		if(in_array($key, $ignoreArray))
			continue;
	?>
	<?php $checked = (is_array($genmFields) && in_array($key, $genmFields)) ? 'checked="checked"' : null; ?>
	<li style="float: left; margin: 0; padding: 0; width: 160px;">
		<input <?php echo $checked; ?> name="jform[fields][]" type="checkbox" value="<?php echo $key; ?>" /> <span style="float: left; line-height: 23px;"><?php echo $key; ?></span>
	</li>
	<?php endforeach; ?>
</ul>